<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="en">
	<head>
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<meta charset="utf-8" />

		<meta name="description" content="overview &amp; stats" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />

		<!-- bootstrap & fontawesome -->
		<link rel="stylesheet" href="plug-in/ace2/assets/css/bootstrap.min.css" />
		<link rel="stylesheet" href="plug-in/ace2/assets/css/font-awesome.min.css" />
		 

		<!-- page specific plugin styles -->

		<!-- text fonts -->
		<link rel="stylesheet" href="plug-in/ace2/assets/css/ace-fonts.css" />

		<!-- ace styles -->
		<link rel="stylesheet" href="plug-in/ace2/assets/css/ace.min.css" id="main-ace-style" />

		<!--[if lte IE 9]>
			<link rel="stylesheet" href="../assets/css/ace-part2.min.css" />
		<![endif]-->
		<link rel="stylesheet" href="plug-in/ace2/assets/css/ace-skins.min.css" />
		<link rel="stylesheet" href="plug-in/ace2/assets/css/ace-rtl.min.css" />

		<!--[if lte IE 9]>
		  <link rel="stylesheet" href="../assets/css/ace-ie.min.css" />
		<![endif]-->

		<!-- inline styles related to this page -->

		<!-- ace settings handler -->
		<script src="plug-in/ace2/assets/js/ace-extra.min.js"></script>
	

		<!-- HTML5shiv and Respond.js for IE8 to support HTML5 elements and media queries -->

		<!--[if lte IE 8]>
		<script src="../assets/js/html5shiv.min.js"></script>
		<script src="../assets/js/respond.min.js"></script>
		<![endif]-->
		<link href="plug-in/lhgDialog/skins/metrole.css" rel="stylesheet" id="lhgdialoglink">
		
		
		
		<style type="text/css">
		tr,.itemDevice{
		cursor:pointer;
		}
		.price{
		float:right;
		color:#FF892A;
		}
		.inline{
		width:100%;
		}
		</style>
	</head>


	<body class="no-skin" onload="initNotice();initUseDevice();initDevice();initMessage();initConsumList();initUseRoom();initRoom();">
		<!-- #section:basics/navbar.layout -->
	 <t:base type="jquery,easyui,tools"></t:base>

		<!-- /section:basics/navbar.layout -->
		<div class="main-container" id="main-container">
			<script type="text/javascript">
				try{ace.settings.check('main-container' , 'fixed')}catch(e){}
			</script>



			<!-- /section:basics/sidebar -->
			<div class="main-content">
				 

				<!-- /section:basics/content.breadcrumbs -->
				<div class="page-content">


					<!-- /section:settings.box -->
					<div class="page-content-area">

						<div class="row">
							<div class="col-xs-12">

								<!-- /section:custom/extra.hr -->
								<div class="row">
									<div class="col-sm-6">
										<div class="widget-box transparent">
											<div class="widget-header widget-header-flat">
												<h4 class="widget-title lighter">
													<i class="ace-icon fa fa-star orange"></i>
													公告信息 
												</h4>

												<div class="widget-toolbar">
													<a href="#" data-action="collapse">
														<i class="ace-icon fa fa-chevron-up"></i>
													</a>
												</div>
											</div>

											<div class="widget-body" >
												<div class="widget-main no-padding">
													<table class="table table-bordered table-striped">
														<thead class="thin-border-bottom">
															<tr>
																<th>时间</th> 
																<th>标题</th> 
															</tr>
														</thead>

														<tbody id="noticeBody">
														</tbody>
													</table>
												</div> 
											</div> 
										</div> 
									</div> 
									
									<div class="col-sm-5" style="margin-left:20px;min-height:200px;">
										<div class="widget-box transparent">
											<div class="widget-header widget-header-flat">
												<h4 class="widget-title lighter">
													<i class="ace-icon fa fa-credit-card  orange"></i>
													消费记录
												</h4>

												<div class="widget-toolbar">
													<a href="#" data-action="collapse">
														<i class="ace-icon fa fa-chevron-up"></i>
													</a>
												</div>
											</div>

											<div class="widget-body" >
												<div class="widget-main no-padding">
													<table class="table table-bordered table-striped">
														<thead class="thin-border-bottom">
															<tr>
																<th>类型</th> 
																<th>交易时间</th>
																<th>交易金额</th> 
															</tr>
														</thead>

														<tbody id="consumeLogList">
														</tbody>
													</table>
												</div><!-- /.widget-main -->
											</div><!-- /.widget-body -->
										</div><!-- /.widget-box -->
									</div><!-- /.col -->

									 
								</div><!-- /.row -->

								<div class="hr hr32 hr-dotted"></div>

								<div class="row">
									<div class="col-sm-6">
										<div class="widget-box transparent" id="recent-box">
											<div class="widget-header">
												<h4 class="widget-title lighter smaller">
													<i class="ace-icon fa fa-rss orange"></i>设备信息
												</h4>

												<div class="widget-toolbar no-border">
													<ul class="nav nav-tabs" id="recent-tab">
														<li class="active">
															<a data-toggle="tab" href="#task-tab">已借设备</a>
														</li>

														<li>
															<a data-toggle="tab" href="#member-tab">可借设备</a>
														</li>

													</ul>
												</div>
											</div>

											<div class="widget-body">
												<div class="widget-main padding-4">
													<div class="tab-content padding-8">
														<div id="task-tab" class="tab-pane active">
															 

															<!-- #section:pages/dashboard.tasks -->
															<ul id="usetasks" class="item-list">

															</ul>

															<!-- /section:pages/dashboard.tasks -->
														</div>

														<div id="member-tab" class="tab-pane ">
															 
															<!-- #section:pages/dashboard.tasks -->
															<ul id="tasks" class="item-list">
															
															</ul>															</ul>

 														</div>

													</div>
												</div><!-- /.widget-main -->
											</div><!-- /.widget-body -->
										</div><!-- /.widget-box -->
									</div><!-- /.col -->
								
									<div class="col-sm-5" style="margin-left:20px;min-height:200px;">
										<div class="widget-box transparent">
											<div class="widget-header widget-header-flat">
												<h4 class="widget-title lighter"> 
													<i class="ace-icon fa fa-envelope orange"></i>
													站内信 
												</h4>

												<div class="widget-toolbar">
													<a href="#" data-action="collapse">
														<i class="ace-icon fa fa-chevron-up"></i>
													</a>
												</div>
											</div>

											<div class="widget-body">
												<div class="widget-main no-padding">
													<table class="table table-bordered table-striped">
														<thead class="thin-border-bottom">
															<tr>
																<th>
																	标题
																</th>

																<th>
																	时间
																</th>

																<th class="hidden-480">
																	类型
																</th>
															</tr>
														</thead>

														<tbody id="message" >
														</tbody>
													</table>
												</div><!-- /.widget-main -->
											</div><!-- /.widget-body -->
										</div><!-- /.widget-box -->
									</div><!-- /.col -->


								<!-- PAGE CONTENT ENDS -->
							</div><!-- /.col -->
							<div class="hr hr32 hr-dotted"></div>
							<div class="row">
									<div class="col-sm-6">
										<div class="widget-box transparent" id="recent-box">
											<div class="widget-header">
												<h4 class="widget-title lighter smaller">
													<i class="ace-icon fa fa-rss orange"></i>机房信息
												</h4>

												<div class="widget-toolbar no-border">
													<ul class="nav nav-tabs" id="recent-tab">
														<li class="active">
															<a data-toggle="tab" href="#useRoom-tab">已预约机房</a>
														</li>

														<li>
															<a data-toggle="tab" href="#roomAble-tab">可预约机房</a>
														</li>

													</ul>
												</div>
											</div>

											<div class="widget-body">
												<div class="widget-main padding-4">
													<div class="tab-content padding-8">
														<div id="useRoom-tab" class="tab-pane active">
															 

															<!-- #section:pages/dashboard.tasks -->
															<ul id="useRoom" class="item-list">

															</ul>

															<!-- /section:pages/dashboard.tasks -->
														</div>

														<div id="roomAble-tab" class="tab-pane ">
															 
															<!-- #section:pages/dashboard.tasks -->
															<ul id="roomAble" class="item-list">
															
															</ul>															</ul>

 														</div>

													</div>
												</div><!-- /.widget-main -->
											</div><!-- /.widget-body -->
										</div><!-- /.widget-box -->
									</div><!-- /.col -->
								<!-- PAGE CONTENT ENDS -->
							</div><!-- /.col -->
						</div><!-- /.row -->
					</div><!-- /.page-content-area -->
				</div><!-- /.page-content -->
			</div><!-- /.main-content -->



			<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
				<i class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i>
			</a>
		</div><!-- /.main-container -->

		<!-- basic scripts -->

		<!--[if !IE]> -->
		<script type="text/javascript">
			window.jQuery || document.write("<script src='plug-in/ace2/assets/js/jquery.min.js'>"+"<"+"/script>");
		</script>

		<!-- <![endif]-->


		<script src='plug-in/ace2/assets/js/jquery.min.js'></script>
		<script src="plug-in/ace2/assets/js/bootstrap.min.js"></script>

		<!-- page specific plugin scripts -->

		<!--[if lte IE 8]>
		  <script src="../assets/js/excanvas.min.js"></script>
		<![endif]-->
		<script src="plug-in/ace2/assets/js/jquery-ui.custom.min.js"></script>
		<script src="plug-in/ace2/assets/js/jquery.ui.touch-punch.min.js"></script>
		<script src="plug-in/ace2/assets/js/jquery.easypiechart.min.js"></script>
		<script src="plug-in/ace2/assets/js/jquery.sparkline.min.js"></script>
		<script src="plug-in/ace2/assets/js/flot/jquery.flot.min.js"></script>
		<script src="plug-in/ace2/assets/js/flot/jquery.flot.pie.min.js"></script>
		<script src="plug-in/ace2/assets/js/flot/jquery.flot.resize.min.js"></script>

		<!-- ace scripts -->
		<script src="plug-in/ace2/assets/js/ace-elements.min.js"></script>
		<script src="plug-in/ace2/assets/js/ace.min.js"></script>

		<!-- inline scripts related to this page -->
		<script type="text/javascript">
			jQuery(function($) {
			
				$('.sparkline').each(function(){
					var $box = $(this).closest('.infobox');
					var barColor = !$box.hasClass('infobox-dark') ? $box.css('color') : '#FFF';
					$(this).sparkline('html',
									 {
										tagValuesAttribute:'data-values',
										type: 'bar',
										barColor: barColor ,
										chartRangeMin:$(this).data('min') || 0
									 });
				});
			
			
			  //flot chart resize plugin, somehow manipulates default browser resize event to optimize it!
			  //but sometimes it brings up errors with normal resize event handlers
			  $.resize.throttleWindow = false;
			
			   
			
			
			  //pie chart tooltip example
			  var $tooltip = $("<div class='tooltip top in'><div class='tooltip-inner'></div></div>").hide().appendTo('body');
			  var previousPoint = null;
			
			  

			
				 
				$('#recent-box [data-rel="tooltip"]').tooltip({placement: tooltip_placement});
				function tooltip_placement(context, source) {
					var $source = $(source);
					var $parent = $source.closest('.tab-content')
					var off1 = $parent.offset();
					var w1 = $parent.width();
			
					var off2 = $source.offset();
					//var w2 = $source.width();
			
					if( parseInt(off2.left) < parseInt(off1.left) + parseInt(w1 / 2) ) return 'right';
					return 'left';
				}
			
			
				$('.dialogs,.comments').ace_scroll({
					size: 300
			    });
				
				
				//Android's default browser somehow is confused when tapping on label which will lead to dragging the task
				//so disable dragging when clicking on label
				var agent = navigator.userAgent.toLowerCase();
				if("ontouchstart" in document && /applewebkit/.test(agent) && /android/.test(agent))
				  $('#tasks').on('touchstart', function(e){
					var li = $(e.target).closest('#tasks li');
					if(li.length == 0)return;
					var label = li.find('label.inline').get(0);
					if(label == e.target || $.contains(label, e.target)) e.stopImmediatePropagation() ;
				});
			
				$('#tasks').sortable({
					opacity:0.8,
					revert:true,
					forceHelperSize:true,
					placeholder: 'draggable-placeholder',
					forcePlaceholderSize:true,
					tolerance:'pointer',
					stop: function( event, ui ) {
						//just for Chrome!!!! so that dropdowns on items don't appear below other items after being moved
						$(ui.item).css('z-index', 'auto');
					}
					}
				);
				$('#tasks').disableSelection();
				$('#tasks input:checkbox').removeAttr('checked').on('click', function(){
					if(this.checked) $(this).closest('li').addClass('selected');
					else $(this).closest('li').removeClass('selected');
				});
			
			
				//show the dropdowns on top or bottom depending on window height and menu position
				$('#task-tab .dropdown-hover').on('mouseenter', function(e) {
					var offset = $(this).offset();
			
					var $w = $(window)
					if (offset.top > $w.scrollTop() + $w.innerHeight() - 100) 
						$(this).addClass('dropup');
					else $(this).removeClass('dropup');
				});
			
			})
		</script>

		<!-- the following scripts are used in demo only for onpage help and you don't need them -->
		<link rel="stylesheet" href="plug-in/ace2/assets/css/ace.onpage-help.css" />
		<link rel="stylesheet" href="plug-in/ace2/docs/assets/js/themes/sunburst.css" />

		<script type="text/javascript"> ace.vars['base'] = '..'; </script>
		<script src="plug-in/ace2/assets/js/ace/elements.onpage-help.js"></script>
		<script src="plug-in/ace2/assets/js/ace/ace.onpage-help.js"></script>
		<script src="plug-in/ace2/docs/assets/js/rainbow.js"></script>
		<script src="plug-in/ace2/docs/assets/js/language/generic.js"></script>
		<script src="plug-in/ace2/docs/assets/js/language/html.js"></script>
		<script src="plug-in/ace2/docs/assets/js/language/css.js"></script>
		<script src="plug-in/ace2/docs/assets/js/language/javascript.js"></script>
		<script type="text/javascript" src="plug-in/lhgDialog/lhgdialog.min.js?skin=metrole"></script>
		<script type="text/javascript">
		  function initNotice(){
				  var url = "systemNoticeController.do?indexList";
					$.ajax({
			    		url:url,
			    		type:"GET",
			    		dataType:"JSON",
			    		data:{
			    		},
			    		success:function(data){
			    			$("#noticeBody").html("");
			    			for(var i=0;i<data.length;i++){
			    				var tr = "<tr onclick=\"doRead('"+data[i].id+"','"+data[i].isRead+"')\"> <td> <b class=\"green\">"+data[i].createTime+"</b></td><td>"+data[i].noticeTitle+"</td></tr> ";
			    				$("#noticeBody").append(tr);
			    			}
			    			if(data.length == 0){
			    				$("#noticeBody").append("<tr ><td colspan='2'>暂无公告信息！</td></tr>");
			    			}
			    		}
			    	});
		  }
		  
		  function initConsumList(){
			  var url = "studentAccountController.do?consumeList";
				$.ajax({
		    		url:url,
		    		type:"GET",
		    		dataType:"JSON",
		    		data:{
		    		},
		    		success:function(data){
		    			$("#consumeLogList").html("");
		    			for(var i=0;i<data.length;i++){
		    				var tr = "<tr> <td> "+data[i].type+"</td><td>"+data[i].date+"</td><td>"+data[i].amount+"</td></tr> ";
		    				$("#consumeLogList").append(tr);
		    			}
		    			if(data.length == 0){
		    				$("#consumeLogList").append("<tr ><td colspan='2'>暂无消费记录！</td></tr>");
		    			}
		    		}
		    	});
	  	}
		  
		  //可预约设备
		  function initDevice(){
			  var url = "deviceAppointApplyController.do?indexList";
				$.ajax({
		    		url:url,
		    		type:"GET",
		    		dataType:"JSON",
		    		data:{
		    		},
		    		success:function(data){	
		    			$("#tasks").html(""); 
		    			for(var i=0;i<data.length;i++){
		    				var tr = "<li class=\"itemDevice item-blue clearfix\"> <label class=\"inline\">  <span class=\"lbl\">"+data[i].brand+"&nbsp;"+data[i].model+"</span><span class=\"price\">￥"+data[i].price+"</span> </label></li> ";
		    				$("#tasks").append(tr);
		    			}
		    			if(data.length == 0){
		    				$("#tasks").append("<li>暂无信息！</li>");
		    			}
		    		}
		    	});
	  }
		  
		
		  
		  function initMessage(){
			  var url = "jformInnerMailController.do?indexMessageList";
				$.ajax({
		    		url:url,
		    		type:"GET",
		    		dataType:"JSON",
		    		data:{
		    		},
		    		success:function(data){	
		    			$("#message").html(""); 
		    			for(var i=0;i<data.length;i++){
		    				var tr = "<tr onclick=\"doReadMessage('"+data[i].id+"','"+data[i].mailId+"')\"><td>"+data[i].title+"</td><td><b class=\"green\">"+data[i].sendTime+"</b></td><td class=\"hidden-480\">";
		    				if(data[i].type == "0"){
		    					tr = tr+"<span class=\"label label-info arrowed-right arrowed-in\">提醒</span>	</td></tr>";
		    				}else{
		    					tr = tr+"<span <span class=\"label label-danger arrowed\">警告</span>	</td></tr>";
		    				}
		    				$("#message").append(tr);
		    			}
		    		}
		    	});
	  }
		  
		  function initUseDevice(){
			  var url = "deviceAppointApplyController.do?useDeviceList";
				$.ajax({
		    		url:url,
		    		type:"GET",
		    		dataType:"JSON",
		    		data:{
		    		},
		    		success:function(data){	
		    			$("#usetasks").html("");//已经借用的设备 
		    			for(var i=0;i<data.length;i++){
		    				var tr = "<li class=\"item-blue clearfix\"> <label class=\"inline\">  <span class=\"lbl\">"+data[i].date+"</span><span class=\"price\" style=\"margin-right:50px\">"+data[i].name+"</span> </label></li> ";
		    				$("#usetasks").append(tr);
		    			}
		    			if(data.length == 0){
		    				$("#usetasks").append("<li>暂无信息！</li>");
		    			}
		    		}
		    	});
	  }
		  function initUseRoom(){
			  var url = "computerRoomController.do?indexList";
				$.ajax({
		    		url:url,
		    		type:"GET",
		    		dataType:"JSON",
		    		data:{
		    		},
		    		success:function(data){	
		    			$("#useRoom").html("");//已借用机房的设备 
		    			for(var i=0;i<data.length;i++){
		    				var tr = "<li class=\"item-blue clearfix\"> <label class=\"inline\">  <span class=\"lbl\">"+data[i].computerRoom.buildingNo+"号 "+data[i].computerRoom.roomNo+"室</span><span class=\"price\" style=\"margin-right:50px\">"+data[i].selectedSeats+"</span> </label></li> ";
		    				$("#useRoom").append(tr);
		    			}
		    			if(data.length == 0){
		    				$("#useRoom").append("<li>暂无信息！</li>");
		    			}
		    		}
		    	});
	  }
	
		  //可预约机房
		  function initRoom(){
			  var url = "computerRoomController.do?indexRoomList";
				$.ajax({
		    		url:url,
		    		type:"GET",
		    		dataType:"JSON",
		    		data:{
		    		},
		    		success:function(data){	
		    			$("#roomAble").html(""); 
		    			for(var i=0;i<data.length;i++){
		    				var tr = "<li class=\"item-blue clearfix\"> <label class=\"inline\">  <span class=\"lbl\">"+data[i].buildingNo+"号 "+data[i].roomNo+"室</span><span class=\"price\" style=\"margin-right:50px\">"+data[i].begin+"至"+data[i].end+"</span> </label></li> ";
		    				$("#roomAble").append(tr);
		    			}
		    			if(data.length == 0){
		    				$("#roomAble").append("<li>暂无信息！</li>");
		    			}
		    		}
		    	});
	  }
		  
		  
		  function doRead(id,isRead){
			  if(isRead!=1){
				  var url = "systemNoticeController.do?updateNoticeRead";
					$.ajax({
			    		url:url,
			    		type:"GET",
			    		dataType:"JSON",
			    		data:{
			    			noticeId:id
			    		},
			    		success:function(data){
// 			    			if(data.success){
// 			    				$('#noticeList').datagrid({   
// 			    				    rowStyler:function(index,row){   
// 			    				        if (row.isRead!=1){
// 			    				            return 'font-weight:bold !important;';   
// 			    				        }else{
// 			    				        	return 'font-weight:normal;';
// 			    				        }
// 			    				    }   
// 			    				});
// 			    			}
			    		}
			    	});
			  }
			  var addurl = "systemNoticeController.do?goNotice&id="+id;
			  $.dialog({
				  	id:'xxx',
					content: 'url:'+addurl,
					lock : true,
					zIndex: 1000, 
					width:680,
					height:600,
					title:'公告详情 ', 
					opacity : 0.3,
					cache:false,
				    cancelVal: '关闭',
				    cancel: true /*为true等价于function(){}*/
				});
		  }
		
		  function doReadMessage(id,mailid){
			  var addurl = "jformInnerMailController.do?goDetail&id="+id+"&mailid="+mailid;
			  $.dialog({
				  	id:'xxx',
					content: 'url:'+addurl,
					lock : true,
					zIndex: 1000, 
					width:580,
					height:400,
					title:'站内信详情 ', 
					opacity : 0.3,
					cache:false,
				    cancelVal: '关闭',
				    cancel: true /*为true等价于function(){}*/
				});
		  }
		  
		</script>
	</body>
</html>
